<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>cx:hash-document</title>
      <meta charset="utf-8" />
      <meta name="generator" content="DocBook XSL 2.0 Stylesheets V2.5.0" />
      <link href="css/default.css" rel="stylesheet" type="text/css" />
      <link href="css/db-prism.css" rel="stylesheet" type="text/css" />
      <link rel="stylesheet" href="css/xproc.css" type="text/css" /><script type="text/javascript" src="js/dbmodnizr.js"></script></head>
   <body>
      <div class="page">
         <div class="content">
            <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="navheader">
               <table border="0" cellpadding="0" cellspacing="0" width="100%" summary="Navigation table">
                  <tr>
                     <td align="left"> <a title="XML Calabash Reference" href="index.html"><img src="img/home.png" alt="Home" border="0" /></a> <a href="cx-get-cookies.html" title="cx:get-cookies"><img src="img/prev.png" alt="Prev" border="0" /></a> <a title="XML Calabash Extension Steps" href="cx-steps.html"><img src="img/up.png" alt="Up" border="0" /></a> <a title="cx:java-properties" href="cx-java-properties.html"><img src="img/next.png" alt="Next" border="0" /></a></td>
                     <td align="right"><i>XML Calabash Reference</i> (Version 0.28)</td>
                  </tr>
               </table>
            </div>
            <div class="body">
               <article id="cx-hash-document" class="refentry">
                  <div class="content">
                     <div class="refnamediv">
                        <h2>Name</h2>
                        <p><span class="refname">cx:hash-document</span><span class="refpurpose"><span class="refpurpose-sep"> — </span><span class="refpurpose-text">Compute the hash of a document</span><span class="refpurpose-punc">.</span></span></p>
                     </div>
                     <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="refsynopsisdiv">
                        <h2>Synopsis</h2>
                        <p class="element-syntax element-syntax-declare-step-opt"><span class="decl"><code>&lt;p:declare-step</code> <code class="attr type-attr">type</code><code>="</code><code class="value type-value">cx:hash-document</code><code>"</code> <code class="attr xmlns-attr">xmlns:cx</code><code>="</code><code class="value xmlns-value">http://xmlcalabash.com/ns/extensions</code><code>"</code><code>&gt;</code></span><br />     <span class="input"><code>&lt;p:input</code> <code class="attr port-attr">port</code><code>="</code><code class="value port-value">source</code><code>"</code><code>/&gt;</code></span><br />     <span class="input"><code>&lt;p:output</code> <code class="attr port-attr">port</code><code>="</code><code class="value port-value">result</code><code>"</code><code>/&gt;</code></span><br />     <span class="input"><code>&lt;p:input</code> <code class="attr port-attr">port</code><code>="</code><code class="value port-value">parameters</code><code>"</code> <code class="attr kind-attr">kind</code><code>="</code><code class="value kind-value">parameter</code><code>"</code><code>/&gt;</code></span><br />     <span class="opt-req"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">algorithm</code><code>"</code> <code class="attr required-attr">required</code><code>="</code><code class="value required-value">true</code><code>"</code><code>/&gt;</code><code>                  </code><code class="comment">&lt;!-- </code><span class="opt-type">QName</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">hash-version</code><code>"</code><code>/&gt;</code><code>                               </code><code class="comment">&lt;!-- </code><span class="opt-type">string</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">byte-order-mark</code><code>"</code><code>/&gt;</code><code>                            </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">cdata-section-elements</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">''</code><code>"</code><code>/&gt;</code><code>         </code><code class="comment">&lt;!-- </code><span class="opt-type">ListOfQNames</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">doctype-public</code><code>"</code><code>/&gt;</code><code>                             </code><code class="comment">&lt;!-- </code><span class="opt-type">string</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">doctype-system</code><code>"</code><code>/&gt;</code><code>                             </code><code class="comment">&lt;!-- </code><span class="opt-type">anyURI</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">encoding</code><code>"</code><code>/&gt;</code><code>                                   </code><code class="comment">&lt;!-- </code><span class="opt-type">string</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">escape-uri-attributes</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'false'</code><code>"</code><code>/&gt;</code><code>     </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">include-content-type</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'true'</code><code>"</code><code>/&gt;</code><code>       </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">indent</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'false'</code><code>"</code><code>/&gt;</code><code>                    </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">media-type</code><code>"</code><code>/&gt;</code><code>                                 </code><code class="comment">&lt;!-- </code><span class="opt-type">string</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">method</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'xml'</code><code>"</code><code>/&gt;</code><code>                      </code><code class="comment">&lt;!-- </code><span class="opt-type">QName</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">normalization-form</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'none'</code><code>"</code><code>/&gt;</code><code>         </code><code class="comment">&lt;!-- </code><span class="opt-type">NormalizationForm</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">omit-xml-declaration</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'true'</code><code>"</code><code>/&gt;</code><code>       </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">standalone</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'omit'</code><code>"</code><code>/&gt;</code><code>                 </code><code class="comment">&lt;!-- </code><span class="opt-type">"true" | "false" | "omit"</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">undeclare-prefixes</code><code>"</code><code>/&gt;</code><code>                         </code><code class="comment">&lt;!-- </code><span class="opt-type">boolean</span><code class="comment"> --&gt;</code></span><br />     <span class="opt-opt"><code>&lt;p:option</code> <code class="attr name-attr">name</code><code>="</code><code class="value name-value">version</code><code>"</code> <code class="attr select-attr">select</code><code>="</code><code class="value select-value">'1.0'</code><code>"</code><code>/&gt;</code><code>                     </code><code class="comment">&lt;!-- </code><span class="opt-type">string</span><code class="comment"> --&gt;</code></span><br /><code>&lt;/p:declare-step&gt;</code></p>
                     </div>
                     <div class="refsection">
                        <div class="refsection-titlepage">
                           <h2>Description</h2>
                        </div>
                        <div class="content">
                           
                           
                           
                           
                           <p>The <code class="tag-element">p:hash-document</code> step is, operationally, a bit
                              like a combination of the <code class="tag-element">p:store</code> and <code class="tag-element">p:hash</code>
                              steps. It begins by serializing the document that appears on the
                              <code class="literal port">source</code> port using the serialization
                              parameters specified. Like <code class="tag-element">p:store</code>, it accepts an extension
                              option to decode binary documents.</p>
                           
                           
                           <p>Next, a hash is computed for the serialized document. The hash
                              options accepted are the same as those for <code class="tag-element">p:hash</code>.</p>
                           
                           
                           <div class="note admonition">
                              <h3>Note</h3>
                              <div class="admonition-body">
                                 <p>Both the <code class="tag-element">p:store</code> and <code class="tag-element">p:hash</code> steps have a
                                    <code class="tag-attribute">version</code> option. In <code class="tag-element">p:hash-document</code>,
                                    the <code class="tag-attribute">version</code> option is used exclusively
                                    for serialization. To specify the version of the hashing algorithm,
                                    you <em>must</em> use the <code class="tag-attribute">hash-version</code>
                                    option.</p>
                              </div>
                           </div>
                           
                           
                           <div class="warning admonition">
                              <h3>Warning</h3>
                              <div class="admonition-body">
                                 <p>If an XML (or JSON) document is passed to
                                    <code class="tag-element">p:hash-document</code>, the step <em>does not</em> produce a
                                    canonical serialization before computing the hash. This step is
                                    therefore not reliable for hashes of XML documents.
                                    (Canonicalization
                                    <a href="https://github.com/ndw/xmlcalabash1/issues/275">will be added</a>
                                    in the future.)
                                    </p>
                              </div>
                           </div>
                           
                           
                           <p>The computed hash is returned in a <code class="tag-element">c:result</code> element
                              on the <code class="literal port">output</code> port.</p>
                           
                           </div>
                     </div>
                  </div>
               </article>
            </div>
         </div>
         <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="navfooter">
            <table width="100%" summary="Navigation table">
               <tr>
                  <td width="40%" align="left"><a title="cx:get-cookies" href="cx-get-cookies.html"><img src="img/prev.png" alt="Prev" border="0" /></a> </td>
                  <td width="20%" align="center"><a title="XML Calabash Reference" href="index.html"><img src="img/home.png" alt="Home" border="0" /></a></td>
                  <td width="40%" align="right"> <a title="cx:java-properties" href="cx-java-properties.html"><img src="img/next.png" alt="Next" border="0" /></a></td>
               </tr>
               <tr>
                  <td width="40%" align="left">cx:get-cookies </td>
                  <td width="20%" align="center"><a title="XML Calabash Extension Steps" href="cx-steps.html"><img src="img/up.png" alt="Up" border="0" /></a></td>
                  <td width="40%" align="right"> cx:java-properties</td>
               </tr>
            </table>
         </div>
         <div xmlns:tmpl="http://docbook.org/xslt/titlepage-templates" class="copyrightfooter">
            <p><a href="dbcpyright.html">Copyright</a> © 2011–2020 Norman Walsh.</p>
         </div>
      </div>
   </body>
</html>